package com.rongzhe.house.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

import com.rongzhe.house.R;
import com.rongzhe.house.presenter.UserAuthPresenter;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by huang on 2018/1/2.
 */

public class UserAuthActivity extends BaseActivity<UserAuthPresenter> {
    @BindView(R.id.edit_real_name)
    EditText editRealName;
    @BindView(R.id.edit_idcard_number)
    EditText editIdcardNumber;
    @BindView(R.id.image_id_card_font)
    ImageView imageIdCardFont;
    @BindView(R.id.image_id_card_back)
    ImageView imageIdCardBack;
    @BindView(R.id.btn_go_authentication)
    Button btnGoAuthentication;

    @Override
    protected UserAuthPresenter createPresenter() {
        return new UserAuthPresenter(this);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_authentication);
        ButterKnife.bind(this);
    }

    @OnClick(R.id.image_id_card_font)
    public void onUploadFrontClick() {
        mPresenter.uploadFront();
    }

    @OnClick(R.id.image_id_card_back)
    public void onUploadBackClick() {
        mPresenter.uploadBack();
    }

    @OnClick(R.id.btn_go_authentication)
    public void onDoAuthClick() {
        mPresenter.doAuthtication();
    }

    public void setFrontImage(String url) {
        Picasso.with(this).load(url).into(imageIdCardFont);
    }

    public void setBackImage(String url) {
        Picasso.with(this).load(url).into(imageIdCardBack);
    }

    @Override
    protected String getActionTitle() {
        return getString(R.string.authentication);
    }
}
